<template>
  <router-view></router-view>
</template>

<script>
import { defineComponent, reactive, toRefs, provide, nextTick } from "vue";

export default defineComponent({
  name: "App",
  setup() {
    const data = reactive({
      isRouterAlive: true,
    });
    const reload = () => {
      console.log("刷新");
      data.isRouterAlive = false;
      nextTick(() => {
        data.isRouterAlive = true;
      });
    };
    provide("reload", reload);
    return {
      ...toRefs(data),
      reload,
    };
  },
});
</script>
